package com.chmingx.utils;

import com.chmingx.utils.constant.ResponseCode;
import lombok.Data;

@Data
public class CommonResponse<T> {
    private Integer code;
    private String msg;
    private T data;

    public CommonResponse() {
    }

    public static <T> CommonResponse<T> ok(){
        CommonResponse<T> commonResponse = new CommonResponse<>();
        commonResponse.setCode(ResponseCode.SUCCESS);
        commonResponse.setMsg("成功");
        return commonResponse;
    }

    public static <T> CommonResponse<T> error(){
        CommonResponse<T> commonResponse = new CommonResponse<>();
        commonResponse.setCode(ResponseCode.ERROR);
        commonResponse.setMsg("失败");
        return commonResponse;
    }
}
